<include file="public@header"/>

<link href="__TMPL__/public/assets/themes/{:cmf_get_admin_style()}/bootstrap.min.css" media="all" rel="stylesheet">
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li  class="active"><a href="{:url('HelpAward/index')}">助学金管理</a></li>
        <li>
            <a href="#" id="new_card" >编辑助学金</a>
        </li>
    </ul>
    <form class="well form-inline margin-top-20 row" method="post" action="{:url('HelpAward/index')}">
        <label class="col-md-6 col-xs-12 form-group" style="margin-bottom: 15px;">
           申请日期:
            <input type="text" class="form-control" name="create_time" id="create_time"
                   value="{$param.start_time|default=''}" placeholder="">
            -<input type="text" class="form-control" name="create_time1" id="create_time1"
                    value="{$param.create_time1|default=''}" placeholder="">
        </label>
        <label class="col-md-3 col-xs-6  form-group" style="margin-bottom: 15px;">
            学号:
            <input type="text" class="form-control" name="code" id="code"
                   value="{$param.code|default=''}" placeholder="">
        </label>
        <label class="col-md-3 col-xs-6  form-group" style="margin-bottom: 15px;">
            姓名:
            <input type="text" class="form-control" name="student_name" id="name"
                   value="{$param.student_name|default=''}" placeholder="">
        </label>
        <label class="col-md-6 col-xs-6  form-group">
            类型:
            <select class="form-control" name="status" id="is_used">
                <option value="0">全部</option>
                <if condition="isset($param.status) && $param.status==1">
                    <option value="1" selected>未处理</option>
                    <else/>
                    <option value="1">未处理</option>
                </if>
                <if condition="isset($param.status) && $param.status==2">
                    <option value="2" selected>通过</option>
                    <else/>
                    <option value="2">通过</option>
                </if>
                <if condition="isset($param.status) && $param.status==3">
                    <option value="3" selected>未通过</option>
                    <else/>
                    <option value="3">未通过</option>
                </if>
            </select>
        </label>
        <label class="col-md-6 col-sm-6   form-group">
            <input type="submit"  class="btn btn-primary" value="搜索"/>
            <a class="btn btn-danger" href="{:url('HelpAward/index')}">清空</a>
        </label>
    </form>
    <form class="js-ajax-form" action="" method="post">
        <div class="table-actions">
            <button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
                    data-action="{:url('HelpAward/delete')}" data-subcheck="true" data-msg="您确定删除吗？">
                批量删除
            </button>
        </div>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="15">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <th width="50">编号</th>
                <th width="100">学号</th>
                <th width="100">姓名</th>
                <th width="100">申请等级</th>
                <th width="100">申请日期</th>

                <th width="70">申请理由</th>
                <th width="70">材料</th>
                <th width="150">状态</th>
                <th width="150">操作</th>
                <th width="100">操作人</th>
                <th width="100">操作时间</th>

            </tr>
            </thead>
            <foreach name="data" item="vo">
                <tr>
                    <td>
                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.id}" title="ID:{$vo.id}">
                    </td>
                    <td>{$vo.id}</td>
                    <td>{$vo.code}</td>
                    <td>{$vo.tname}</td>
                    <td>
                        <if condition="!empty($vo.type) && $vo.type==1">
                            <option value="{$vo.type}">  疾病</option>
                            <elseif condition="$vo.type==2">
                                <option value="{$vo.type}"> 单亲 </option>
                            </elseif>
                            <else/>
                            <option value="{$vo.type}">  其他 </option>
                        </if>
                    </td>
                    <td>
                        {$vo.create_time|date="Y-m-d H:i",###}
                    </td>

                    <td>{$vo.content}</td>
                    <td>
                        <a href="{:url('HelpAward/down',array('asset_id'=>$vo.asset_id))}">{$vo.filename}</a>
                    </td>
                    <td>
                        <if condition="!empty($vo.status) && $vo.status==1">
                            <span class="label label-warning">待处理</span>
                            <elseif condition="!empty($vo.status) && $vo.status==2">
                                <span class="label label-success">通过</span>
                            </elseif>
                            <elseif condition="!empty($vo.status) && $vo.status==3">
                                <span class="label label-danger">未通过</span>
                            </elseif>
                            <else />
                        </if>
                    </td>
                    <td>
                        <if condition="!empty($vo.status) && $vo.status==1">
                                <a href="{:url('HelpAward/editPost',array('id'=>$vo['id'],'status'=>2))}" data-msg="确定同意通过吗？"class="js-ajax-delete">通过</a>
                            &nbsp;&nbsp;
                            <a href="{:url('HelpAward/editPost',array('id'=>$vo['id'],'status'=>3))}" data-msg="确定同意不通过吗？" class="js-ajax-delete">不通过</a>
                            <else/>
                                /
                        </if>
                    </td>
                    <td>{$vo.uname}</td>
                    <td>
                        <if condition="!empty($vo.update_time)">
                            {$vo.update_time|date="Y-m-d H:i",###}
                            <else/>

                        </if>
                    </td>
                </tr>
            </foreach>
        </table>
        <div class="pagination">{$page|default=''}</div>
    </form>
</div>

<div id="card_add_msg"   style="display: none">
    <form action="{:url('HelpAward/editZhuPost')}" method="post"  class="well row js-ajax-form" style="margin:0px;">
        <select name="type" class="form-control" id="type">
            <option value="0">请选择级别</option>
        <foreach name="help_money_data" item="vo">
                    <if condition="$vo.type==1">
                        <option value="{$vo.type}">  疾病</option>
                        <elseif condition="$vo.type==2">
                            <option value="{$vo.type}"> 单亲 </option>
                         </elseif>
                        <else/>
                        <option value="{$vo.type}">  其他 </option>
                        </if>
        </foreach>
        </select>
        <label class="form-group" for="" id="money">
            金额:<span class="form-required">*</span>
            <input class="form-control" type="number"  id='award_money0'  >

            <foreach name="help_money_data" item="vo">
                    <if condition="$vo.type==1">
                        <input class="form-control" type="text" name="award_money1"  id='award_money1' required="required" value="{$vo.price}" style="display: none">
                        <elseif condition="$vo.type==2">
                            <input class="form-control" type="text" name="award_money2"  id='award_money2' required="required" value="{$vo.price}" style="display: none">
                        </elseif>
                        <else/>
                        <input class="form-control" type="text" name="award_money3"  id='award_money3' required="required" value="{$vo.price}"  style="display: none">
                    </if>
            </foreach>
        </label>
        <button type="submit" id="submit" style="display:none;"  class="btn btn-primary js-ajax-submit"></button>
    </form>
</div>


<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/layer/layer.js"></script>
<script>
    $(function()
    {
        $('#create_time1').datepicker();
        $('#create_time').datepicker();
        $("body").on("click",'#new_card',function()
        {
            var $card_type=$("[name='card_type']").val();
            var $card=$("[name='card']").val();
            var $amount=$("[name='amount']").val();
            var $student_id=$("[name='student_id']").val();
            var valid_date=$("[name='valid_date']").val();
            $('input').blur(function ()
            {
                $card_type=$("[name='$card_type']").val();
                $card=$("[name='card']").val();
                $amount=$("[name='amount']").val();
                $student_id=$("[name='student_id']").val();
            })
            layer.open
            ({
                type: 1,
                btn: ['提交'],
                title: '编辑助学金',
                content: $('#card_add_msg'),
                yes: function (index,layero)
                {
                    $('#submit').click();
                }
            })
        })
        $("body").on('change','#type',function(){
           $val= $("#type").find('option:selected').val();
            if($val==1)
            {
                $("#award_money0").hide();
                $("#award_money1").show();
                $("#award_money2").hide();
                $("#award_money3").hide();
            }
            if($val==2)
            {
                $("#award_money2").show();
                $("#award_money1").hide();
                $("#award_money0").hide();
                $("#award_money3").hide();
            }
            if($val==3)
            {
                $("#award_money3").show();
                $("#award_money2").hide();
                $("#award_money1").hide();
                $("#award_money0").hide();
            }
        })
    })
</script>
</body>
